home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / infop125.arc / PAGE_03.INC < prev    next >
Text File  |  1991-04-28  |  7KB  |  272 lines

  1. procedure page_03;
  2. type
  3.   string2 = string[2];
  4.  
  5. const
  6.   EMMint = $67;
  7.   qEMMdrvr = 'EMMXXXX0';
  8.  
  9. var
  10.   EMMarray : array[$000..$3FF] of word;
  11.   xlong : longint;
  12.   xword1 : word;
  13.   xword2 : word;
  14.   xstring : string;
  15.   EMMver, j: byte;
  16.   EMMname: array[1..8] of char;
  17.  
  18.   procedure EMMerr(a : byte);
  19.     begin
  20.     case a of
  21.       $80 : writeln('internal error in EMM software');
  22.       $81 : writeln('malfunction in expanded memory hardware');
  23.       $82 : writeln('memory manager busy');
  24.       $83 : writeln('invalid handle');
  25.       $84 : writeln('undefined function');
  26.       $85 : writeln('no more handles available');
  27.       $86 : writeln('error in save or restore of mapping context');
  28.       $87 : writeln('not enough physical pages available');
  29.       $88 : writeln('not enough free pages available');
  30.       $89 : writeln('no pages requested');
  31.       $8A : writeln('logical page outside range assigned to handle');
  32.       $8B : writeln('invalid physical page number');
  33.       $8C : writeln('page map hardware state save area full');
  34.       $8D : writeln('mapping context already in save area');
  35.       $8E : writeln('mapping context not in save area');
  36.       $8F : writeln('undefined subfunction parameter')
  37.       else
  38.         unknown('expanded memory error', a, 2)
  39.     end
  40.     end; {EMMerr}
  41.  
  42.   procedure showbcd(x: word);
  43.     var
  44.       c: char;
  45.  
  46.     begin
  47.     c:=Chr((x shr 12) + 48);
  48.     if c <> '0' then
  49.       Write(c);
  50.     Write(Chr(((x and $0F00) shr 8) + 48), Chr(country[9]),
  51.       Chr(((x and $00F0) shr 4) + 48), Chr((x and $000F) + 48))
  52.     end; {showbcd}
  53.  
  54.   begin (* procedure page_03 *)
  55.   caption2('Total conventional memory (bytes)');
  56.   writeln(DOSmem : 6);
  57.   caption2('Free conventional memory (bytes) ');
  58.   writeln(DOSmem - longint(prefixseg) shl 4 : 6);
  59.   caption2('Extended memory (from BIOS)    ');
  60.   with regs do begin
  61.     AH:=$88;
  62.     intr($15, regs);
  63.     if nocarry then
  64.       writeln(longint(AX) shl 10 : 8)
  65.     else
  66.       writeln('     N/A')
  67.   end;
  68.   caption2('XMS driver present ');
  69.   with regs do
  70.     begin
  71.     AX:=$4300;
  72.     Intr($2F, regs);
  73.     if AL <> $80 then
  74.       Writeln('no')
  75.     else
  76.       begin
  77.       Writeln('yes');
  78.       AX:=$4310;
  79.       Intr($2F, regs);
  80.       xlong:=longint(ES) shl 16 + BX;
  81.       caption3('XMS version');
  82.       longcall(0, xlong, AX, BX, DX);
  83.       if AX <> 0 then
  84.         begin
  85.         showbcd(AX);
  86.         caption3('XMM version');
  87.         showbcd(BX);
  88.         caption3('HMA');
  89.         yesorno2(DX = 1);
  90.         end
  91.       else
  92.         Write('ERROR');
  93.       caption3('A20 is');
  94.       longcall($0700, xlong, AX, BX ,DX);
  95.       if (AX <> 0) or ((AX = 0) and (BL = 0)) then
  96.         case AX of
  97.           0: Writeln('disabled');
  98.           1: Writeln('enabled');
  99.         else
  100.           Writeln('unknown');
  101.         end
  102.       else
  103.         Writeln('ERROR');
  104.       caption3('Total free XMS memory');
  105.       longcall($0800, xlong, AX, BX, DX);
  106.       if (AX <> 0) or ((AX = 0) and (BL = 0)) then
  107.         begin
  108.         Write(DX, 'K');
  109.         caption3('Largest available block');
  110.         Writeln(AX, 'K');
  111.         end
  112.       else
  113.         Writeln('ERROR');
  114.       end
  115.     end;
  116.   caption2('DPMI driver present');
  117.   with regs do
  118.     begin
  119.     AX:=$1687;
  120.     Intr($2F, regs);
  121.     if AL <> 0 then
  122.       Writeln('no')
  123.     else
  124.       begin
  125.       Writeln('yes');
  126.       caption3('version');
  127.       Write(DH, Chr(country[9]), DL);
  128.       caption3('CPU');
  129.       case CL of
  130.         2: Write('286');
  131.         3: Write('386');
  132.         4: Write('486')
  133.       else
  134.         Write('???')
  135.       end;
  136.       caption3('switch mode entry');
  137.       segofs(ES, DI);
  138.       Writeln
  139.       end
  140.     end;
  141.   caption2('Expanded memory');
  142.   if longint(intvec[EMMint]) <> $00000000 then
  143.     begin
  144.     writeln;
  145.     caption3('Interrupt vector');
  146.     xlong:=longint(intvec[EMMint]);
  147.     xword1:=xlong shr 16;
  148.     xword2:=xlong and $0000FFFF;
  149.     segofs(xword1, xword2);
  150.     writeln;
  151.     caption3('Driver');
  152.     xstring:='';
  153.     for i:=$000A to $0011 do
  154.       xstring:=xstring + showchar(chr(mem[xword1 : i]));
  155.     write(xstring);
  156.     if xstring = qEMMdrvr then
  157.       begin
  158.       caption3('status');
  159.       with regs do
  160.         begin
  161.         AH:=$40;
  162.         intr(EMMint, regs);
  163.         if AH = $00 then
  164.           writeln('available')
  165.         else
  166.           EMMerr(AH);
  167.         caption3('EMM version');
  168.         AH:=$46;
  169.         intr(EMMint, regs);
  170.         if AH = $00 then
  171.           writeln(AL shr 4, Chr(country[9]), AL and $0F)
  172.         else
  173.           EMMerr(AH);
  174.         EMMver:=AL shr 4;
  175.         caption3('Page frame segment');
  176.         AH:=$41;
  177.         intr(EMMint, regs);
  178.         if AH = $00 then
  179.           writeln(hex(BX, 4))
  180.         else
  181.           EMMerr(AH);
  182.         caption3('Total EMS memory');
  183.         AH:=$42;
  184.         intr(EMMint, regs);
  185.         if AH = $00 then
  186.           begin
  187.           write(longint(16) * DX, 'K');
  188.           caption3('available');
  189.           if AH = $00 then
  190.             writeln(longint(16) * BX, 'K')
  191.           else
  192.             EMMerr(AH)
  193.           end
  194.         else
  195.           EMMerr(AH);
  196.         if EMMver >= 4 then
  197.           begin
  198.           caption3('VCPI capable');
  199.           {must make sure 1 page is allocated to be sure that EMS}
  200.           {driver is ON. VCPI is not detectable if EMS driver is OFF}
  201.           {16K of EMS needed for this test to work properly}
  202.           AH:=$43;
  203.           BX:=1;
  204.           Intr(EMMint, regs);
  205.           if AH <> 0 then
  206.             Writeln('error: need 16K available EMS to detect')
  207.           else
  208.             begin
  209.             xword1:=DX; {handle}
  210.             AX:=$DE00;
  211.             Intr(EMMint, regs);
  212.             if AH <> 0 then
  213.               Writeln('no')
  214.             else
  215.               begin
  216.               Write('yes');
  217.               caption3('VCPI version');
  218.               Writeln(BH, Chr(country[9]), BL);
  219.               end;
  220.             AH:=$45; {release our handle}
  221.             DX:=xword1;
  222.             Intr(EMMint, regs)
  223.             end
  224.           end;
  225.         caption1('  Handle   Size  Name');
  226.         writeln;
  227.         AH:=$4D;
  228.         ES:=seg(EMMarray);
  229.         DI:=ofs(EMMarray);
  230.         intr(EMMint, regs);
  231.         if AH = $00 then
  232.           if BX > $0000 then
  233.             begin
  234.             window(3, wherey + hi(windmin), twidth, tlength - 2);
  235.             for i:=1 to BX do
  236.               begin
  237.               pause2;
  238.               if endit then
  239.                 Exit;
  240.               write(hex(EMMarray[2 * i - 2], 4), '   ',
  241.                 (longint(16) * EMMarray[2 * i - 1]):5, 'K  ');
  242.               if EMMver >= 4 then
  243.                 begin
  244.                 AX:=$5300;
  245.                 DX:=EMMarray[2 * i - 2];
  246.                 ES:=Seg(EMMname);
  247.                 DI:=Ofs(EMMname);
  248.                 Intr(EMMint, regs);
  249.                 if AH = 0 then
  250.                   for j:=1 to 8 do
  251.                     if EMMname[j] <> #0 then
  252.                       Write(EMMname[j]);
  253.                 end;
  254.               Writeln;
  255.               end
  256.             end
  257.           else
  258.             writeln('  (no active handles)')
  259.         else
  260.           EMMerr(AH)
  261.         end
  262.       end
  263.     else
  264.       begin
  265.       Writeln;
  266.       dontknow
  267.       end
  268.     end
  269.   else
  270.     writeln('(none)')
  271.   end;
  272.